import { EggAppConfig, PowerPartial } from 'egg';
import {ipAddree, sqlPwd} from './constant';

export default () => {
    const config: PowerPartial<EggAppConfig> = {};
    config.cluster = {
        listen: {
            port: 7001,
            // hostname: '0.0.0.0',
            hostname: '127.0.0.1',
        },
    };
    config.typeorm = {
        client: {
            type: 'mysql',
            host: ipAddree,
            port: 3306,
            username: 'root',
            password: sqlPwd,
            database: 'cool',
            synchronize: false,//一定要false
            logging: false,
            charset: 'utf8mb4'
        }
    };
    // config.kuaidiniao = {
    //     actualTimeUrl : 'http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json',//实时查询
    //     companyDistinguishUrl : 'http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json',//公司识别
    //     debug: true,
    //     key:'86f30f71-d3a3-42d9-94b6-3a8e41b6fae8',
    //     id:'test1680984'
    // }

    config.kuaidiniao = {
        actualTimeUrl : 'https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx',//实时查询
        companyDistinguishUrl : 'https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx',//公司识别
        debug: true,
        key:'495be51e-c82b-4212-a3af-036dd6b6914e',
        id:'1680984'
    }


    // //多出来的配置==========
    // config.cors = {
    //     credentials: true, // 允许跨域请求携带cookies
    //     origin:'*',
    //     // origin: ctx => ctx.get('origin'),
    //     // origin: ctx => ctx.get('origin'),
    //     // origin: () => 'http://qianshop.fortunemy.top',//这边不能为*号，需要指定明确的、与请求网页一致的域名,
    //     // origin:'http://localhost:9000,http://qianshop.fortunemy.top,http://127.0.0.1:7001',
    //     allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS'
    // }
    return config;
};
